import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/home/home.vue'
import Activity from '../views/activity/activity.vue'
import My from '../views/my/my.vue'

Vue.use(VueRouter)

const routes = [
  {
    path:"",
    redirect:"/home"
  },
  {
    path: '/home',
    name: 'home',
    component: Home,
    meta:{
      showNavBar:true,
    },
  },
  {
    path:"/activity",
    name:"activity",
    component:Activity,
    meta:{
      showNavBar:true,
    },
    // children:[
    // ]
  },
  {
    path:"/activity/turntable",
    name:"turntable",
    component:()=>import("@/views/activity/components/turntable.vue"),
    meta:{
      showNavBar:false
    }
  },
  {
    path:"/activity/smashEggs",
    component:()=>import("@/views/activity/components/smashEggs.vue"),
    meta:{
      showNavBar:false
    }
  },
  {
    path:"/activity/endActivity",
    component:()=>import("@/views/activity/components/endActivity.vue"),
    meta:{
      showNavBar:false
    }
  },
  
  {
    path:"/my",
    name:"my",
    component:My,
    meta:{
      showNavBar:true,
    },
  }
]
const routerPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(error=> error)
}

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
